home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Mark Pilgrim / Jotto ][ 1.2 / source / Wipes reversed ƒ / Quadrant wipe reversed.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-30  |  2.4 KB  |  83 lines  |  [TEXT/MMCC]

  1. #include "timing.h"
  2.  
  3. #define CorrectTime 3
  4. #define theWindowHeight (boundsRect.bottom-boundsRect.top)
  5. #define theWindowWidth (boundsRect.right-boundsRect.left)
  6. #define NUM_ITERATIONS    25
  7.  
  8. pascal short QuadrantWipeReversed(GrafPtr sourceGrafPtr, GrafPtr destGrafPtr, Rect boundsRect);
  9.  
  10. /* 4 regions, splitting the screen into 4 quadrants.  Wipe the screen right in
  11.    the top-left quadrant, down in the top-right, left in the bottom-right,
  12.    up in the bottom-left. */
  13.    
  14. pascal short QuadrantWipeReversed(GrafPtr sourceGrafPtr, GrafPtr destGrafPtr, Rect boundsRect)
  15. {
  16.     short            x;
  17.     Rect        tldest, trdest, bldest, brdest;
  18.     Rect        tlbounds, trbounds, blbounds, brbounds;
  19.     RgnHandle    tlrgn, trrgn, blrgn, brrgn;
  20.     short            cx,cy;
  21.     short            BoxSize, HBoxSize;
  22.     
  23.     BoxSize=theWindowHeight/(NUM_ITERATIONS*2);
  24.     HBoxSize=theWindowWidth/(NUM_ITERATIONS*2);
  25.     
  26.     cx = boundsRect.left + theWindowWidth / 2;
  27.     cy = boundsRect.top + theWindowHeight / 2;
  28.     
  29.     tlbounds=trbounds=blbounds=brbounds=tldest=trdest=bldest=brdest=boundsRect;
  30.     tlbounds.right=trbounds.left=blbounds.right=brbounds.left=
  31.         tldest.right=trdest.left=bldest.right=brdest.left=cx;
  32.     tlbounds.bottom=trbounds.bottom=blbounds.top=brbounds.top=
  33.         tldest.bottom=trdest.bottom=bldest.top=brdest.top=cy;
  34.     tlrgn=NewRgn();
  35.     trrgn=NewRgn();
  36.     blrgn=NewRgn();
  37.     brrgn=NewRgn();
  38.     RectRgn(tlrgn, &tlbounds);
  39.     RectRgn(trrgn, &trbounds);
  40.     RectRgn(blrgn, &blbounds);
  41.     RectRgn(brrgn, &brbounds);
  42.     brdest.right=brdest.left+HBoxSize;
  43.     bldest.bottom=bldest.top+BoxSize;
  44.     tldest.left=tldest.right-HBoxSize;
  45.     trdest.top=trdest.bottom-BoxSize;
  46.     
  47.     for (x=0; x<NUM_ITERATIONS; x++)
  48.     {
  49.         StartTiming();
  50.         CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  51.                 &brdest, &brdest, 0, brrgn);
  52.         brdest.left+=HBoxSize;
  53.         brdest.right+=HBoxSize;
  54.         
  55.         CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  56.                 &bldest, &bldest, 0, blrgn);
  57.         bldest.top+=BoxSize;
  58.         bldest.bottom+=BoxSize;
  59.         
  60.         CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  61.                 &tldest, &tldest, 0, tlrgn);
  62.         tldest.left-=HBoxSize;
  63.         tldest.right-=HBoxSize;
  64.         
  65.         CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  66.                 &trdest, &trdest, 0, trrgn);
  67.         trdest.top-=BoxSize;
  68.         trdest.bottom-=BoxSize;
  69.         
  70.         TimeCorrection(CorrectTime);
  71.     }
  72.     
  73.     CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  74.         &boundsRect, &boundsRect, 0, 0L);
  75.     
  76.     DisposeRgn(tlrgn);
  77.     DisposeRgn(trrgn);
  78.     DisposeRgn(blrgn);
  79.     DisposeRgn(brrgn);
  80.     
  81.     return 0;
  82. }
  83.